/**
 * @author liuzy
 * 系统安全上下文，通过SecurityContextHolder.getContext()获得
 * 用于取得当前系统用户登录信息
 */
package com.wjf.birdfish.util;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;


public class SecurityContext implements Serializable {
	private static final long serialVersionUID = 1L;
	public static final String SECURITY_CONTEXT = "security-context-store-key";
	public static final String SECURITY_AREA = "security-area";

//	private SysUserAcct sysUser;
	private String area; // NORTH_6, SOUTH_25
	private String[] duns;
	private String agentIp;
	private Date loginTime;
	private String provsType;
	private String projectName;

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getProvsType() {
		return provsType;
	}

	/**
	 * 返回登录的用户是否属于总部
	 * */
	public boolean isProvice() {
		return "1".equals(this.provsType);
	}

	public void setProvsType(String provsType) {
		this.provsType = provsType;
	}

	private boolean isLogined;

//	public SysUserAcct getSysUser() {
//		return sysUser;
//	}
	
//	public boolean isAdministrator() {
//		return SecurityContext.isAdministrator(sysUser);
//	}
	
//	public static final boolean isAdministrator(SysUserAcct sysUser) {
//		if (sysUser == null) {
//			return false;
//		}
//		Set<SysUserRoleRelation> userRoles = sysUser.getSysUserRoles();
//		if (userRoles == null) {
//			return false;
//		}
//		for (SysUserRoleRelation ur: userRoles) {
//			if (ur.getSysUserRole().getRoleId().equals(System.getProperty("role.administrator", "111111"))) {
//				return true;
//			}
//		}
//		return false;
//	}
//
//	public void setSysUser(SysUserAcct sysUser) {
//		this.sysUser = sysUser;
//	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String[] getDuns() {
		return duns;
	}

	public void setDuns(String[] duns) {
		this.duns = duns;
	}

	public String getAgentIp() {
		return agentIp;
	}

	public void setAgentIp(String agentIp) {
		this.agentIp = agentIp;
	}

	public Date getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}

	public boolean isLogined() {
		return isLogined;
	}

	public void setLogined(boolean isLogined) {
		this.isLogined = isLogined;
	}

}
